﻿@model Dziennik_MVC.Models.Entities.Studenci

@{
    ViewBag.Title = "Edit";

    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Edycja konta studenta</legend>

        @Html.HiddenFor(model => model.id_studenta)

        <div class="editor">
            @Html.HiddenFor(model => model.login)
        </div>

        <div class="editor">
            @Html.HiddenFor(model => model.haslo)
        </div>

        <div class="editor">
            @Html.LabelFor(model => model.imie)
            @Html.EditorFor(model => model.imie)
            @Html.ValidationMessageFor(model => model.imie)
        </div>

        <div class="editor">
            @Html.LabelFor(model => model.nazwisko)
            @Html.EditorFor(model => model.nazwisko)
            @Html.ValidationMessageFor(model => model.nazwisko)
        </div>

        <div class="editor">
            @Html.LabelFor(model => model.nr_indeksu)
            @Html.HiddenFor(model => model.nr_indeksu)
            @Html.TextBoxFor(model => model.nr_indeksu, new { disabled ="disabled"})
            @Html.ValidationMessageFor(model => model.nr_indeksu)
        </div>

        <div class="editor">
            @Html.LabelFor(model => model.Grupy)
            @Html.DropDownListFor(model => model.id_grupy, ((IEnumerable<Dziennik_MVC.Models.Entities.Grupy>)ViewBag.ListaGrup).Select(option => 
            new SelectListItem
                {
                    Text = option.nazwa_grupy.ToString() + " - ID Grupy:" + option.id_grupy,
                    Value = option.id_grupy.ToString()
                })
            )
            @Html.ValidationMessageFor(model => model.Grupy)
            
        </div>

        <p>
            <input type="submit" value="Zapisz zmiany" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("powrót do listy studentów", "List")
</div>
